﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
<head>
<title>S_SearchNextの使用例</title>
<LINK REL="stylesheet" TYPE="text/css" HREF="../sakura.css">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
</head>
<body>
<small>
Sakura-Editor Macro Reference
</small>
<h2>S_SearchNextの使用例</h2>

<pre>
<span style="color:green;">&#39; sample.vbs</span>
<span style="color:green;">&#39; 文字列"function"の数をカウントする</span>
<span style="color:blue;">Dim</span> sKey, lngCnt
sKey = <span style="color:#800000;">"function"</span>

<span style="color:blue;">GoFileTop</span>
lngLine = <span style="color:blue;">ExpandParameter</span>(CStr(<span style="color:#800000;">"$y"</span>))
<span style="color:blue;">SearchNext</span> <span style="color:blue;">CStr</span>(sKey), <span style="color:blue;">CLng</span>(<span style="color:red;">16</span>)

<span style="color:blue;">Do</span> <span style="color:blue;">Until</span> (<span style="color:blue;">ExpandParameter</span>(<span style="color:blue;">CStr</span>(<span style="color:#800000;">"$y"</span>)) = lngLine)
    lngCnt = lngCnt + <span style="color:red;">1</span>
    lngLine = <span style="color:blue;">ExpandParameter</span>(<span style="color:blue;">CStr</span>(<span style="color:#800000;">"$y"</span>))
    <span style="color:blue;">SearchNext</span> <span style="color:blue;">CStr</span>(sKey), <span style="color:blue;">CLng</span>(<span style="color:red;">16</span>)
<span style="color:blue;">Loop</span>

<span style="color:blue;">MsgBox</span> <span style="color:#800000;">"文字列 """</span> & sKey & <span style="color:#800000;">"""は、"</span> & lngCnt & <span style="color:#800000;">"個みつかりました"</span>
</pre>

<hr>
</body></html>
